package controllers;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

import model.Employee;
import model.Envelope;
import model.User;
import view.AreaGui;
import view.CategoryGui;
import view.CustomerReportGui;
import view.ItemToCatalogGUI;
import view.MMaddTypeGui;
import view.MarketingGui;
import view.MarketingManagerGui;
import view.SalesReportGui;
import view.StartCampignGui;
/**
 * This Class is a Marketing Manager Controller, which extends MarketingController
 * @author jacob
 *
 */

public class MarketingManagController extends MarketingController {
	MarketingManagerGui MarkManGui;
	public MarketingManagerGui getMarkManGui() {
		return MarkManGui;
	}
	MarketingManagController tempCon;
	/**
	 * Constructor 
	 * @param MC is Employee instance
	 * @param MG is MarketingGui instance
	 * @param lastCon is LoginController instance which is previous Controller
	 */
	public MarketingManagController(Employee MC, MarketingManagerGui MG,LoginController lastCon) {
		super(MC,MG,lastCon);
		MarkManGui = MG;
		tempCon = this;
		// TODO Auto-generated constructor stub
		//MarkGui.
		MarkManGui.additemToCatalogActionListener(new itemToCatalogListener());
		MarkManGui.addActivateCampaignActionListener(new ActivateCampaignListener());
		MarkManGui.addAddTypeActionListener(new AddTypeListener());
		MarkManGui.addAddCategoryActionListener(new AddCategoryListener());
		MarkManGui.addReportActionListener(new ReportActionListener()); //sales report
		MarkManGui.addAddAreaActionListener(new AddAreaListener());
		MarkManGui.addReportCostumerActionListener(new CostumerReportListener());
		
	}
	
/**
 * Inner class that handles when Button Produce costumer report Pressed, implements ActiontListener	
 * @author jacob
 *
 */
	class CostumerReportListener implements ActionListener{  // costumer report

		@Override
		public void actionPerformed(ActionEvent e) {
			// TODO Auto-generated method stub
			MarkManGui.dispose();
			CustomerReportGui CustReportView = new CustomerReportGui();
			CustomerReportController CustRepCont = new CustomerReportController(CustReportView,tempCon);		
		}
	}
	/**
	 * Inner class that handles when Button Add item to_catalog Pressed, implements ActiontListener	
	 * @author jacob
	 *
	 */
	class itemToCatalogListener implements ActionListener{

		@Override
		public void actionPerformed(ActionEvent e) {
			// TODO Auto-generated method stub
			MarkManGui.dispose();
			ItemToCatalogGUI CustReporItemToCatalogtView = new ItemToCatalogGUI();
			ItemToCatalogController ItemToCatalogController = new ItemToCatalogController(CustReporItemToCatalogtView,tempCon);	
		}
	}
/**
 * 	Inner class that handles when Button Activate campaign Pressed, implements ActiontListener	
 * @author jacob
 *
 */
	class ActivateCampaignListener implements ActionListener{

		@Override
		public void actionPerformed(ActionEvent e) {
			// TODO Auto-generated method stub
			MarkManGui.dispose();
			StartCampignGui GG = new StartCampignGui();
			StartCampignController Scon = new StartCampignController(tempCon, GG);
		}
	}
	/**
	 * Inner class that handles when Button Add Type Pressed, implements ActiontListener	
	 * @author jacob
	 *
	 */
	class AddTypeListener implements ActionListener{

		@Override
		public void actionPerformed(ActionEvent e) {
			// TODO Auto-generated method stub
			MarkManGui.dispose();
			MMaddTypeGui addTypeGui = new MMaddTypeGui();
			MMaddTypeController Con = new MMaddTypeController(addTypeGui,tempCon);
			//System.out.println("so far");
		}
	}
	/**
	 * Inner class that handles when Button Add Category Pressed, implements ActiontListener	
	 * @author jacob
	 *
	 */
	class AddCategoryListener implements ActionListener{

		@Override
		public void actionPerformed(ActionEvent e) {
			// TODO Auto-generated method stub
			MarkManGui.dispose();
			CategoryGui CategoryView = new CategoryGui();
			CategoryController CatContr = new CategoryController(CategoryView,tempCon);
			
		}
	}
	/**
	 * Inner class that handles when Button Produce sales report Pressed, implements ActiontListener	
	 * @author jacob
	 *
	 */
	class ReportActionListener implements ActionListener{ //sales report  listener

		@Override
		public void actionPerformed(ActionEvent e) {
			// TODO Auto-generated method stub
			MarkManGui.dispose();
			SalesReportGui ChooseView = new SalesReportGui();
			SalesReportController ChooseCon = new SalesReportController(ChooseView,tempCon);
			
		}
	}
	/**
	 * Inner class that handles when Button Add Area Pressed, implements ActiontListener	
	 * @author jacob
	 *
	 */
	class AddAreaListener implements ActionListener{

		@Override
		public void actionPerformed(ActionEvent e) {
			// TODO Auto-generated method stub
			MarkManGui.dispose();
			AreaGui AreaView =  new AreaGui();
			AreaController  Areacon  = new AreaController(AreaView,tempCon);
				
		}
	}
}
